﻿using System;
using System.ServiceProcess;

namespace Antix.Mail.Smtp.Impostor.Windows
{
    /// <summary>
    ///   <para>Program Class</para>
    /// </summary>
    public class Program
    {
        /// <summary>
        ///   <para>Entry point for Windows Service</para>
        /// </summary>
        /// <param name = "args"></param>
        static void Main(string[] args)
        {
            var service = new ServerService();
            if (Environment.UserInteractive)
            {
                Log.ToConsole();

                service.Start();

                Console.WriteLine("Press Enter to stop...");
                Console.ReadLine();

                service.Stop();
            }
            else
            {
                ServiceBase.Run(
                    new ServiceBase[]
                    {
                        service
                    });
            }
        }
    }
}